﻿namespace Rgr

type Point(x:int, y:int) =
    let mutable internalXValue = x
    let mutable internalYValue = y   
    member this.X
        with get() = internalXValue
        and set(value) = internalXValue <- value
    member this.Y
        with get() = internalYValue
        and set(value) = internalYValue <- value
    member this.len():float =  
        sqrt( abs((float)this.X) * abs((float)this.X) + abs((float)this.Y) * abs((float)this.Y) ) 

with
   override this.ToString() =
        internalXValue.ToString() + " " + internalYValue.ToString()
        
   static member Equals (a:Point, b:Point) =
        let mutable c:Point = a - b;
        c.len() < 1.5

   static member AbsoluteEq (a:Point, b:Point) =
        a.X = b.X && a.Y = b.Y
     
   static member (-) (a:Point, v: Point) =
        Point(a.X - v.X, a.Y - v.Y)
        
   static member CompareX (a:Point, v: Point) =
        a.X >= v.X

   static member CompareY (a:Point, v: Point) =
        a.Y >= v.Y